
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>setindex page</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="css/bootstrap.min.css">  
	<script src="js/jquery.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
<script>
			function getXmlHttpObject(){
				var xmlHttpRequest;
				if(window.ActiveXObject){
					//window.alert("ie");
				}else{
					//window.alert("firefox");
					xmlHttpRequest=new XMLHttpRequest();
				}
				return xmlHttpRequest;
			}
			
			var myXmlHttpRequest;
			var coursename;var teachername; var major;var teanum;
			function addTeacher(){
				myXmlHttpRequest=getXmlHttpObject();
				checkcoursename();
				teachername=document.getElementById("teachername").value;
				major=document.getElementById("major").value;
				teanum=document.getElementById("teanum").value;
				if(myXmlHttpRequest){
					var url="http://localhost:8080/StuScoreSystem/Teacher?method=addTeacher&&teachername="+teachername+"&&major="+major+"&&teanum="+teanum+"&&coursename="+coursename+"";
					//var url="http://localhost:8080/StuScoreSystem/Login?method=adminLogin&&username=admin&&password=123";
					myXmlHttpRequest.open("get",url,true);
					myXmlHttpRequest.onreadystatechange=progress;
					myXmlHttpRequest.send(null);
				}
		
				else{
					window.alert("error");
				}
			}
	
			function progress(){
				if(myXmlHttpRequest.readyState==4){
					var json=myXmlHttpRequest.responseText;
					var json_obj=eval("("+json+")");
					//var json1=JSON.parse(json);
					var state_obj=json_obj.meta;
					window.alert(state_obj.state);
					window.close();
				}
			}
			
			function checkcoursename(){
				var obj=document.getElementById("selector");
				var index=obj.selectedIndex;
				coursename=obj.options[index].text;
			}
</script>

</head>

<body style="background-color:#E0E0E0;">

<ul class="nav nav-tab nav-justified navbar-inverse">
  <li class="active"><a href="#">添加教师信息</a></li>
  <li><a href="#"></a></li>
  <li><a href="#"></a></li>
  <li><a href="#"></a></li>
</ul>

<div id="myModal" class="center-block" style="padding: 60px 100px 10px;width: 800px;">
		
    <form action="Radios?op=radio" method="post" accept-charset="utf-8" class="bs-example bs-example-form" role="form">
  	  <img class="img-circle center-block" src="src/bg.jpg" alt="portait" height="170px" width="200px"/> 
        <div class="input-group">
            <span class="glyphicon glyphicon-user input-group-addon "></span>
             <input type="text" class="form-control" id="teachername" name="teachername" placeholder="教师姓名">
        </div>
        <br>
        <div class="input-group">
            <span class="glyphicon glyphicon glyphicon-pencil input-group-addon "></span>
             <input type="text" class="form-control"  id="teanum" name="teanum" placeholder="职工号">
        </div>
        <br>
        <div class="input-group">
            <span class="glyphicon glyphicon-pencil input-group-addon "></span>
             <input type="text" class="form-control"  id="major" name="major" placeholder="专业">
        </div>
        <br>
        <div class="input-group">
            <span class="glyphicon glyphicon-pencil input-group-addon "></span>
            <select  class=form-control name="coursename" id="selector">
            	<option  values=" " >下拉选择课程
            	</option>
            	<option  values="java">java
            	</option>
            	<option  values="python">python
            	</option>
            	<option  values="Cpp">Cpp
            	</option>
            	<option  values="CSharp">CSharp
            	</option>
            </select>
        </div>
        <br> 
      <span>
        <button class="btn btn-lg btn-primary btn-block center-block" type="button" onclick="addTeacher()" style="width: 300px">
                     提交</button> 
		
	</span>    
    </form>
    	
</div>

</body>

</html>